package com.demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 1. 加载 XML 配置，启动 Spring 容器
        ApplicationContext ctx =
                new ClassPathXmlApplicationContext("beans.xml");

        // 2. 按 id 获取 Bean
        Product p = ctx.getBean("product", Product.class);
        Student s = ctx.getBean("student", Student.class);

        // 3. 打印
        System.out.println(p);
        System.out.println(s);
    }
}